﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Bai1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        int a, b;
        public MainWindow()
        {
            InitializeComponent();
        }
            
        private void mncong_Click(object sender, RoutedEventArgs e)
        {
            a = Convert.ToInt32(tb_a.Text);
            b = Convert.ToInt32(tb_b.Text);
            tb_kq.Text = Convert.ToString(a + b);
        }

        private void mntru_Click(object sender, RoutedEventArgs e)
        {
            a = Convert.ToInt32(tb_a.Text);
            b = Convert.ToInt32(tb_b.Text);
            tb_kq.Text = Convert.ToString(a - b);
        }

        private void mnnhan_Click(object sender, RoutedEventArgs e)
        {
            a = Convert.ToInt32(tb_a.Text);
            b = Convert.ToInt32(tb_b.Text);
            tb_kq.Text = Convert.ToString(a * b);
        }

        private void mnchia_Click(object sender, RoutedEventArgs e)
        {
            float a = float.Parse (tb_a.Text);
            float b = float.Parse (tb_b.Text);
            if (b == 0) MessageBox.Show(" Không chia hết cho 0");
            else tb_kq.Text = Convert.ToString(a / b);
        }

        private void mnreset_Click(object sender, RoutedEventArgs e)
        {
            tb_a.Text = null;
            tb_b.Text = null;
            tb_kq.Text = null;
        }

        private void mnthoat_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Bạn có muốn thoát hay không", "Tâm Gà thông báo", MessageBoxButton.YesNo, MessageBoxImage.Warning);
            if (result == MessageBoxResult.Yes)
            {
                this.Close();
            }
        }

    }
}
